<template>

	<view >
		<view class="cu-card article case  " :class="isCard?'no-card':''" v-for="(i,index) in station" @click="info(i.siteId,i.siteName)">
			<view class="cu-item padding-xl radius shadow-warp bg-white" >
				<view class="title"><view class="text-cut">{{i.siteName}}</view></view>
				<view class="content">
					<image :src="i.img"
					 mode="aspectFill"></image>
					<view class="desc">
						<view class="text-content">{{i.introduce}}</view>
						<view>
							<view class="cu-tag bg-red light sm round" v-if="i.siteState == 0">空闲中</view>
							<view class="cu-tag bg-red light sm round" v-if="i.siteState == 1">使用中</view>
							<view class="cu-tag bg-green light sm round">{{i.businessHours}}营业</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				swiperList: [{
					id: 0,
					type: 'image',
					url: 'https://img.zcool.cn/community/01931c59659405a8012193a37e8d72.png@1280w_1l_2o_100sh.png'
				}, {
					id: 1,
					type: 'image',
					url: 'https://imgs.design006.com/202005/Design006_R8PwaQ3TMS.jpg',
				}, {
					id: 2,
					type: 'image',
					url: 'https://img.tukuppt.com/bg_grid/00/14/74/PJOQxoTdcm.jpg!/fh/350'
				}],
				title: "hongsai",
				current: 0,
				station: []



			}
		},
		onLoad() {

			uni.request({
				url: 'http://127.0.0.1:9000/site/findAllSite',
				method: 'GET',
				data: {},
				success: res => {
					var rs = res.data.data.sitelist
					console.log(rs);
					rs[0].img =
						"https://img.zcool.cn/community/01db2060630dee11013e87f41019d5.jpg@1280w_1l_2o_100sh.jpg"
					rs[1].img =
						"https://ts1.cn.mm.bing.net/th/id/R-C.adc24789fe5acc8336551e112b2e3a78?rik=dn0YhUzfCRam9A&riu=http%3a%2f%2fs3.xchuxing.com%2fxchuxing%2farticle%2f2021%2f06%2f21%2f5667a202106212209274611.jpeg&ehk=oSlx9KZjH52a6cYjw%2flPYQSHE9LuFQEjtVuJsQYkdrs%3d&risl=&pid=ImgRaw&r=0"
					rs[2].img = "https://www.szxilepai.com/uploads/allimg/xlp/wenzhang/20190425/wangdian3.jpg"
					for (var i = 3; i < rs.length; i++) {
						rs[i].img = 'https://img.zcool.cn/community/01db2060630dee11013e87f41019d5.jpg@1280w_1l_2o_100sh.jpg'
					}
					this.station = rs
				},
				fail: () => {},
				complete: () => {}
			});

		},
		methods: {
			navigate: function(uri) {
				uni.navigateTo({
					url: `/pages/${uri}`
				})
			},
			change(e) {
				this.current = e.detail.current;
			},
			all() {
				uni.navigateTo({
					url: 'allcart',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			info(id, name) {
				uni.navigateTo({
					url: './info?id=' + id + '&title=' + name,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}


	}
</script>

<style lang="less">
	page {
		background-color: white;
	}
</style>
